package model;
import java.util.Observable;
import java.util.Observer;
public class RelationshipEditor implements Observer{
	private Relationship relationshipToEdit;
	public RelationshipEditor(){
		
	}
	
	public void update(Observable obj, Object arg){
		if (arg instanceof Relationship){
			this.relationshipToEdit = (Relationship) arg;
		}
		if (arg instanceof Class){
			this.relationshipToEdit = null;
		}
	}
	
	public void commitChanges (int srcMinIn, int srcMaxIn, int destMinIn, int destMaxIn, Class srcIn, Class destIn){
		this.relationshipToEdit.setSrcMin(srcMinIn);
		this.relationshipToEdit.setSrcMax(srcMaxIn);
		this.relationshipToEdit.setDestMin(destMinIn);
		this.relationshipToEdit.setDestMax(destMaxIn);
		this.relationshipToEdit.setSrc(srcIn);
		this.relationshipToEdit.setDest(destIn);
	}
	
	public int getSrcMin( ){
		return this.relationshipToEdit.getSrcMin();
	}
	
	public int getSrcMax( ){
		return this.relationshipToEdit.getSrcMax();
	}
	
	public int getDestMax( ){
		return this.relationshipToEdit.getDestMax();
	}
	
	public int getdestMin( ){
		return this.relationshipToEdit.getDestMin( );
	}
	
	public String getSrcName( ){
		return this.relationshipToEdit.getSrc().getName();
	}
	
	public String getDestName( ){
		return this.relationshipToEdit.getDest().getName( );
	}

}
